package net.xiduth.game.player.dialogues.auto;

import net.xiduth.game.player.dialogues.Dialogue;

/**
 * 
 * @author Oracle
 * 
 * Handles Skilling Rewards and info.
 *
 */
public class SkillsRewards extends Dialogue {

	int npcId;

	@Override
	public void start() {
		npcId = 7411;
		sendNPCDialogue(npcId, LISTEN_LAUGH, "Welcome. How may I help you today?");
	}

	@Override
	public void run(int interfaceId, int option) {
		switch(stage) {
		case -1:
			sendOptionsDialogue("Select an Option", "How many points do I have?", "Exchange my points!", "How do I get points?", "Never mind.");
			stage = 0;
			break;
		case 0:
			switch(option) {
			case OPTION_1:
				sendNPCDialogue(npcId, CALM_TALKING, "You currently have <col=ff0000>" + player.getskillpoints() + "</col> skill points.");
				stage = -1;
				break;
			case OPTION_2:
				sendOptionsDialogue("Skilling Rewards", "10M GP (250 pts.)", "100M GP (1500 pts.)", "100 PvM points (300 pts.)" , "Never mind.");
				stage = 4;
				break;
			case OPTION_3:
				sendNPCDialogue(npcId, LISTEN_LAUGH, "To get points, just train any skill! Each item you recieve from skilling will give you 1 point!");
				stage = -1;
				break;
			case OPTION_4:
				player.getInterfaceManager().closeChatBoxInterface();
				break;
			}
			break;
		case 3:
			end();
			break;
		case 4:
			switch(option) {
		case OPTION_1:
				if (player.getskillpoints() >= 200) {
				player.getBank().addItem(995, 10000000, true);
				player.setskillpoints(player.getskillpoints()
						- 200);
				player.getInterfaceManager().closeChatBoxInterface();
				player.getInterfaceManager().sendChatBoxInterface(1189);
				player.getPackets().sendItemOnIComponent(1189, 1, 995, 1);
				player.getPackets().sendIComponentText(1189, 4, "The items have been added to your bank.");
				stage = 3;
				}else{
				sendNPCDialogue(npcId, 9827, "You need 200 points to buy this item." );
				stage = 3;
				}
				break;
		case OPTION_2:
			if (player.getskillpoints() >= 1500) {
				player.getBank().addItem(995, 100000000, true);
				player.setskillpoints(player.getskillpoints()
						- 1500);
				player.getInterfaceManager().closeChatBoxInterface();
				player.getInterfaceManager().sendChatBoxInterface(1189);
				player.getPackets().sendItemOnIComponent(1189, 1, 995, 1);
				player.getPackets().sendIComponentText(1189, 4, "The items have been added to your bank.");
				stage = 3;
				}else{
				sendNPCDialogue(npcId, 9827, "You need 1500 points to buy this item." );
				stage = 3;
				}
				break;
		case OPTION_3:
			if (player.getskillpoints() >= 300) {
			player.setPvMPoints(player.getPvMPoints()
					+ 100);
			player.getPackets().sendGameMessage("<col=ff0000>You now have " + player.getPvMPoints() + " PvM points.</col>");
			player.setskillpoints(player.getskillpoints()
					- 300);
			player.getInterfaceManager().closeChatBoxInterface();
			stage = 3;
			}else{
			sendNPCDialogue(npcId, 9827, "You need 300 points to buy this item." );
			stage = 3;
			}
			break;
		case OPTION_4:
		stage = 3;
		player.getInterfaceManager().closeChatBoxInterface();
			break;
		default:
			end();
			break;
		}}}

	@Override
	public void finish() {

	}

}
